syntax on
set linebreak
set wrap
set mouse=a
set infercase
set ignorecase
set smartcase
set incsearch
set backspace=indent,eol,start
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set hlsearch
set showbreak=->\ 
set wildmenu
set laststatus=1
set diffopt+=iwhite
set diffexpr="diff --minimal"
"set cursorline
colorscheme desert
set guioptions-=T

"" Latex suite
    " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
    filetype plugin on
    
    " IMPORTANT: win32 users will need to have 'shellslash' set so that latex
    " can be called correctly.
    set shellslash
    
    " IMPORTANT: grep will sometimes skip displaying the file name if you
    " search in a singe file. This will confuse Latex-Suite. Set your grep
    " program to always generate a file-name.
    set grepprg=grep\ -nH\ $*
    
    " OPTIONAL: This enables automatic indentation as you type.
    filetype indent on


"" enable changelog support \o
"" export EMAIL="name <email@domain.org>"
runtime ftplugin/changelog.vim

"  spellchecking
"  download spellfiles from ftp.vim.org/vim/runtime/spell/*.spl to ~/.vim/spell/
":setlocal spell spelllang=en_us

set modeline
"set complete+=kspell
"set formatoptions+=a

" from http://vim.wikia.com/wiki/VimTip38
"noremap <silent> <Leader>w :call ToggleWrap()<CR>
"function ToggleWrap()
"  if &wrap
"    echo "Wrap OFF"
"    setlocal nowrap
"    set virtualedit=all
"    silent! nunmap <buffer> <Up>
"    silent! nunmap <buffer> <Down>
"    silent! nunmap <buffer> <Home>
"    silent! nunmap <buffer> <End>
"    silent! iunmap <buffer> <Up>
"    silent! iunmap <buffer> <Down>
"    silent! iunmap <buffer> <Home>
"    silent! iunmap <buffer> <End>
"  else 
"  echo "Wrap ON"
"    setlocal wrap linebreak nolist
"    set virtualedit=
"    setlocal display+=lastline
"    noremap  <buffer> <silent> <Up>   gk
"    noremap  <buffer> <silent> <Down> gj
"    noremap  <buffer> <silent> <Home> g<Home>
"    noremap  <buffer> <silent> <End>  g<End>
"    inoremap <buffer> <silent> <Up>   <C-o>gk
"    inoremap <buffer> <silent> <Down> <C-o>gj
"    inoremap <buffer> <silent> <Home> <C-o>g<Home>
"    inoremap <buffer> <silent> <End>  <C-o>g<End>
"  endif
"endfunction

noremap  <Up>   gk
noremap  <Down> gj
noremap  <Home> g<Home>
noremap  <End>  g<End>
inoremap <Up>   <C-o>gk
inoremap <Down> <C-o>gj
inoremap <Home> <C-o>g<Home>
inoremap <End>  <C-o>g<End>

"" enable syntax highlighting for .ned files
au BufNewFile,BufRead *.ned set syntax=ned 

"" enable menu as wildmenu, map it to <F4>
if ! has("gui_running")
 :source $VIMRUNTIME/menu.vim
 :set wildmenu
 :set cpo-=<
 :set wcm=<C-Z>
 :map <F4> :emenu <C-Z>
endif

augroup filetypedetect
  au! BufRead,BufNewFile *nc setfiletype nc
augroup END

"include thesaurus from http://www.gutenberg.org/dirs/etext02/mthes10.zip
"use it by typing: CTRL-X CTRL-T, see *i_CTRL-X_CTRL-T*
set thesaurus+=~/.vim/thesaurus/mthesaur.txt

"" use templates for new files
autocmd! BufNewFile * silent! 0r ~/Vorlagen/template.%:e

au BufNewFile,BufRead *.plot set filetype=gnuplot
